ccR.Add_Rotation(
	1, -- Player Specialization
	"CC_Brewmaster_Solo", -- Function name
	"Developed early WoD, Not recommended.", -- Description
	"CC_Brewmaster_Talents", -- Talents button frame
	"CC_Brewmaster_Abilities", -- Abilities button frame
	"CC_Brewmaster_Features", -- Features button frame
	"CC_Brewmaster_Setup" -- Setup button frame
)
function CC_Brewmaster_Solo()
	if ccR.Spell.Is.Ready(GUARD) then ccR.Cast.Spell(GUARD) end
	if ccR.Spell.Is.Ready(ELUSIVE_BREW) and (ccR.Player.Has.Debuff(HEAVY_STAGGER) or ccR.Player.BuffStacks(ELUSIVE_BREW) >= 15 or ccR.Player.BuffDuration(ELUSIVE_BREW, "<=", 5)) then ccR.Cast.Spell(ELUSIVE_BREW) end
-- Purifying Brew
	if ccR.Spell.Is.Ready(PURIFYING_BREW) then
		if ccR.Player.Has.Debuff(HEAVY_STAGGER) and (ccR.Player.BuffDuration(SHUFFLE, ">=", 2) or ccR.Player.Health() <= 30) then ccR.Cast.Spell(PURIFYING_BREW) end
		if ccR.Player.Has.Debuff(MODERATE_STAGGER) and ((ccR.Player.Chi() >= 2 and ccR.Player.Has.BuffDuration(SHUFFLE, ">=", 2)) or ccR.Player.Health() <= 15) then ccR.Cast.Spell(PURIFYING_BREW) end
		if ccR.Player.Has.Debuff(LIGHT_STAGGER) and ((ccR.Player.Chi() >= 3 and ccR.Player.BuffDuration(SHUFFLE, ">=", 4)) or ccR.Player.Health() <= 10) then ccR.Cast.Spell(PURIFYING_BREW) end
	end
	if ccR.Player.Is.InCombat() then
		-- Talents 
		-- Monk\Talents.lua
		-- Tier 1
			ccR.Monk.Talent.Tigers_Lust()
		-- Tier 2
			ccR.Monk.Talent.Chi_Wave()
			ccR.Monk.Talent.Zen_Sphere(100, 4)	-- 100% or less health, 4 enemies around player
			ccR.Monk.Talent.Chi_Burst() 
		-- Tier 3
			ccR.Monk.Talent.Chi_Brew(2) -- Chi Brew on 2 or less Chi
		-- Tier 4
			ccR.Monk.Talent.Ring_of_Peace(4, "player") -- 4 Enemies around player for Ring of Peace, Accepts other unit's and counts around them
			ccR.Monk.Talent.Charging_Ox_Wave(15, 35) -- Uses if between 15 and 35 yards from target
			ccR.Monk.Talent.Leg_Sweep(4) -- 4 Enemies around player for leg sweep
		-- Tier 5
			ccR.Monk.Talent.Dampen_Harm(45) -- Used when reaching 45% or less health
			ccR.Monk.Talent.Diffuse_Magic(45) -- Used when reaching 45% or less health
		-- Tier 6
			-- ccR.Monk.Talent.Rushing_Jade_Wind is part of rotation
			ccR.Monk.Talent.Invoke_Xuen_the_White_Tiger(3) -- Use Xuen on 3+ enemies and on Boss
		-- Features
		-- Monk\Features.lua
			ccR.Monk.Features.Fortifying_Brew(40) -- Fortifying Brew at 40% or less health
			ccR.Monk.Features.Spear_Hand_Strike(1) -- Spell Interupt on 1sec cast or less
			ccR.Monk.Features.Detox() -- Used when player has Poison or Disease
			ccR.Monk.Features.Touch_of_Death()
	end
	if ccR.Target.Is.Attackable() then
		-- Start Attack
		ccR.Start_Attack()
		-- Summon Ox Statue
		if ccR.Spell.Is.Ready(SUMMON_BLACK_OX_STATUE) then
			if (ccR.Target.Is.Boss() and ccR.Target.Count(25) >= 4) or (not ccR.Target.Is.Boss() and ccR.Target.Count(25) >= 3)	and ccR.Player.Statue.Distance(BLACK_OX_STATUE, "target") >= 41 then ccR.Cast.AoE(SUMMON_BLACK_OX_STATUE, "target", 40, 12) end
		end
		-- Provoke the statue because it's a ugly looking bull that deserves it
		if ccR.Spell.Is.Ready(PROVOKE) and ccR.Player.Statue.Distance(BLACK_OX_STATUE, "player") <= 40 then
			local name = BLACK_OX_STATUE
			for x = 1, # ccR_Totems do
				local vTotem = ccR_Totems[x]
				if ((tonumber(name) == nil and ccR.Unit.Name(vTotem) == name) 
				or (tonumber(name) ~= nil and ccR.Unit.NPCID(vTotem) == name))
				and ccR.Unit.GUID(UnitCreator(vTotem)) == ccR.Player.GUID()
				then
					ccR.Cast.Attack(PROVOKE, vTotem)
				end
			end
		end
		-- Rotation
		local PlayerCount = ccR.Player.Count(10)
		if ccR.Player.Is.Facing("target") then
			if ccR.Spell.CanAttack(TIGER_PALM) and not ccR.Player.Has.Buff(TIGER_POWER) then ccR.Cast.Attack(TIGER_PALM) end
			if ccR.Spell.CanAttack(BLACKOUT_KICK) and ccR.Player.BuffDuration(SHUFFLE, "<=", 5) then ccR.Cast.Attack(BLACKOUT_KICK) end
		end
		-- 1-2 enemies
		if PlayerCount <= 2 then
			if ccR.Player.Chi() < 2 then
				ccR.Monk.Chi_Builder(99)
			else
				if ccR.Player.Is.Facing("target") then
					if ccR.Spell.CanAttack(BLACKOUT_KICK) then ccR.Cast.Attack(BLACKOUT_KICK)
					elseif ccR.Spell.CanAttack(TIGER_PALM) then ccR.Cast.Attack(TIGER_PALM) 
					end
				end
			end
		end
		-- 3-5 enemies
		if PlayerCount > 2 and PlayerCount < 6 then
			ccR.Monk.Talent.Rushing_Jade_Wind(2)
			if ccR.Player.Chi() < 2 then
				ccR.Monk.Chi_Builder(99)
			else
				if (not ccR.Player.Has.Buff(SHUFFLE) or ccR.Player.BuffDuration(SHUFFLE, "<=", 5)) and ccR.Player.Is.Facing("target") then
					if ccR.Spell.CanAttack(BLACKOUT_KICK) then ccR.Cast.Attack(BLACKOUT_KICK) end
				else
					if not ccR.Target.Is.Boss() then
						ccR.Monk.Brew_Master.Dizzying_Haze()
						ccR.Monk.Brew_Master.Breath_of_Fire()
					end
				end
			end
			if ccR.Player.Has.Talent(RUSHING_JADE_WIND) then
				if ccR.Player.Is.Facing("target") then
					if ccR.Spell.CanAttack(BLACKOUT_KICK) then ccR.Cast.Attack(BLACKOUT_KICK)
					elseif ccR.Spell.CanAttack(TIGER_PALM) then ccR.Cast.Attack(TIGER_PALM) 
					end
				end
			else
				if (not ccR.Player.Has.Buff(SHUFFLE) or ccR.Player.BuffDuration(SHUFFLE, "<=", 5)) and ccR.Player.Is.Facing("target") then
					if ccR.Spell.CanAttack(BLACKOUT_KICK) then ccR.Cast.Attack(BLACKOUT_KICK) end
				else
					if ccR.Spell.Is.Ready(SPINNING_CRANE_KICK) and not ccR.Player.Has.Talent(RUSHING_JADE_WIND) and ccR.Player.BuffDuration(SHUFFLE, ">=", 2) then ccR.Cast.Spell(SPINNING_CRANE_KICK) end
				end
			end
		end
		-- 6+ enemies
		if PlayerCount >= 6 then
			if ccR.Spell.CanAttack(KEG_SMASH) and ccR.Player.Is.Facing("target") then ccR.Cast.Attack(KEG_SMASH) end
			if ccR.Player.Has.Talent(RUSHING_JADE_WIND) then
				ccR.Monk.Talent.Rushing_Jade_Wind(2)
				if ccR.Player.Chi() < 2 then
					ccR.Monk.Chi_Builder(99)
				else
					if (not ccR.Player.Has.Buff(SHUFFLE) or ccR.Player.BuffDuration(SHUFFLE, "<=", 5)) and ccR.Player.Is.Facing("target") then
						if ccR.Spell.CanAttack(BLACKOUT_KICK) then ccR.Cast.Attack(BLACKOUT_KICK) end
					else
						if not ccR.Target.Is.Boss() then
							ccR.Monk.Brew_Master.Dizzying_Haze()
							ccR.Monk.Brew_Master.Breath_of_Fire()
						end
					end
					if ccR.Spell.CanAttack(TIGER_PALM) and ccR.Player.Is.Facing("target") then ccR.Cast.Attack(TIGER_PALM) end
				end
			else
				if (not ccR.Player.Has.Buff(SHUFFLE) or ccR.Player.BuffDuration(SHUFFLE, "<=", 5)) and ccR.Player.Is.Facing("target") then
					if ccR.Spell.CanAttack(BLACKOUT_KICK) then ccR.Cast.Attack(BLACKOUT_KICK) end
				else
					if ccR.Spell.Is.Ready(SPINNING_CRANE_KICK) and not ccR.Player.Has.Talent(RUSHING_JADE_WIND) and ccR.Player.BuffDuration(SHUFFLE, ">=", 2) then ccR.Cast.Spell(SPINNING_CRANE_KICK) end
				end
			end
		end
	end
end